﻿using FoodModel;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace J.FoodRepository
{
    public class SqlSugarDbcontext
    {
        private  ISqlSugarClient _db { get; set; }

        public SqlSugarDbcontext(ISqlSugarClient db)
        {
            _db = db;
        }

        public void FoodDataBase()
        {
            _db.DbMaintenance.CreateDatabase();
            _db.CodeFirst.SetStringDefaultLength(200).BackupTable().InitTables(new Type[]
            {
                typeof(BenchTableModel),//台位表
                typeof(DineModel),// 堂食设置表
                typeof(DishesModel),//菜品表
                typeof(GroupingModel),//菜品分组表
                typeof(RestaurantModel),//餐厅服务表
                typeof(SpecificationModel),//菜品规格表
                typeof(TableNumModel),//桌号管理表
                typeof(TasteModel),//口味表
                typeof(Vegetables),// 份量表

            });
        }
    }
}
